home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 7
/
FM Towns Free Software Collection 7.iso
/
taropyon
/
hewin
/
ccisrc
/
center02.cci
< prev
next >
Wrap
Text File
|
1993-11-30
|
7KB
|
275 lines
/*************************************************************************
* "center02.cci" : NANNO用センター処理
*************************************************************************/
#ifdef CENTERKEY
#undef CENTERKEY
#endif
#ifdef RECKEY
#undef RECKEY
#endif
#define CENTERKEY "CENTER02"
#define RECKEY _center02_recKey
char *_center02_recKey;
int _CENTER02_init()
{
char *center;
if ( (center = NTM_centerAlloc( CENTERKEY )) != NULL )
{
NtmCenterSetName ( center, "Sample center (type-02:nanno)");
NtmCenterSetFuncKey( center, "CENTER02");
NtmCenterSetRecKey ( center, "CENTER02");
NtmCenterSetRsPara ( center, -1, -1, -1 );
NtmCenterSetRsBreak( center, 50 );
NtmCenterSetCrWait ( center, 100 );
NtmCenterSetTel ( center, "" );
NtmCenterSetModem1 ( center, "ATZ" );
}
return (NORMAL);
}
/*************************************************************************
* ナビゲーション用初期化
*************************************************************************/
int _CENTER02_naviInit( char *ntm, char *center )
{
#ifndef _NAV_IGNORE
NtmSetNaviServiceMode( ntm, 0 ); /* ナビゲーションシステムなし */
#endif
return (NORMAL);
}
/*************************************************************************
* パラメータの指定
*************************************************************************/
int _CENTER02_para( char *ntm, char *center )
{
char *keyWord;
char *id, *pw;
keyWord = NtmCenterGetKeyWord(center);
if ( NTM_centerConfig( keyWord ) == NORMAL )
{
id = NtmCenterGetID ( center );
pw = NtmCenterGetPassword( center );
if ( id[0] == 0 || pw[0] == 0 )
return (ERR);
return (NORMAL);
} else
return (ERR);
}
/*************************************************************************
* 処理の中断
*************************************************************************/
int _CENTER02_abort( char *ntm, char *center )
{
AplRecWrite("%s:Abort", RECKEY);
NTM_offline( ntm, DTR_OFF_TIME );
return (NORMAL);
}
/*************************************************************************
* [AUTO]メニュー処理
*************************************************************************/
int _CENTER02_autoMenu( char *ntm, char *center, int x, int y)
{
int ret;
char *obj;
char *mnu;
char title[128], tmp[128], tmBuf[32];
long loginTime;
if ( ntm == NULL || center == NULL )
return (0);
loginTime = NtmCenterGetTime(center, NTM_TIME_LOGIN );
if ( loginTime )
{ sprintf( tmp, "Login time %s ", GetAsciiTime(tmBuf,loginTime) );
} else
{ strcpy( tmp, "Login time XXXX/XX/XX XX:XX:XX");
}
obj = MNU_alloc(3);
MNU_setObj(obj, 0, MNU_MSG, 0 , tmp , NULL, 0, NULL, NULL );
MNU_setObj(obj, 1, MNU_NOR, 'O', "OFF 終了" , NULL, 1, NULL, NULL );
MNU_setObj(obj, 2, MNU_NOR, 'B', "OFF 強制回線切断", NULL, 2, NULL, NULL );
sprintf( title, "MENU : %s", NtmCenterGetName(center));
mnu = MNU_open( x, y, MNUATT_EXIT, obj, title );
ret = MNU_start ( mnu );
MNU_close(mnu);
MNU_free(obj);
switch ( ret )
{
case 1:
return NTM_callLogout( ntm );
case 2:
NTM_wait(3);
AplRecWrite("%s:Abort disconnect", RECKEY);
return NTM_offline(ntm, DTR_OFF_TIME);
}
return (NORMAL);
}
/*************************************************************************
* ログイン処理
*************************************************************************/
int _CENTER02_login( char *ntm, char *center )
{
int i, ret, retry;
char *name, *tel, *id, *pw, *para;
int argc;
char *s, **argv;
long tm;
char *cns;
char *mos;
mos = NULL;
cns = NtmGetCnsPtr(ntm);
#ifdef _TAROPYON_SYSTEM
/* ログ保存行数を増やす */
if ( CnsGet_maxLinBuf(cns) < 99999 )
CnsSet_maxLinBuf(cns,99999);
#endif
_center02_recKey = NtmCenterGetRecKey(center);
name = NtmCenterGetName ( center );
tel = NtmCenterGetTel ( center );
id = NtmCenterGetID ( center );
pw = NtmCenterGetPassword( center );
if ( tel[0] == 0 || id[0] == 0 || pw[0] == 0 )
{
_ntm_errmsg_no_setup_id_and_pw();
if ( _CENTER02_para( ntm, center ) )
return (ERR);
id = NtmCenterGetID ( center );
pw = NtmCenterGetPassword( center );
tel = NtmCenterGetTel ( center );
}
_ntm_dspmsg_dial_start( name, tel, cns );
AplRecWrite("%s:Dial start tel.%s", RECKEY, tel );
if ( ntm_dialStart( ntm, tel ) != NORMAL )
{
ABORT: _CENTER02_abort( ntm, center );
if ( mos ) MOS_pop(mos);
return (ERR);
}
mos = MOS_push();
MOS_curType(MOSCUR_TIME);
MOS_CON();
AplRecWrite("%s:Connect", RECKEY );
NTM_wait(1);
ret = NTM_waitStr( ntm, 30, "HIT RETURN KEY>", NULL);
if ( ret == NTM_WAIT_CANCEL )
goto ABORT;
NTM_rsPuts(ntm,"\r");
NTM_wait(1);
ret = NTM_waitStr( ntm, 30, "User ID=", NULL );
if ( ret == NTM_WAIT_CANCEL )
goto ABORT;
NTM_wait(1);
NTM_rsPuts( ntm, id ); NTM_rsPuts(ntm,"\r");
ret = NTM_waitStr( ntm, 30, "Password=", NULL);
if ( ret == NTM_WAIT_CANCEL )
goto ABORT;
NTM_wait(1);
NTM_rsPuts( ntm, pw ); NTM_rsPuts(ntm,"\r");
/* ログイン時間 */
time(&tm);
NtmCenterSetTime( center, NTM_TIME_LOGIN, tm );
AplRecWrite("%s:Login successful", RECKEY );
MOS_pop(mos);
return (NORMAL);
}
/*************************************************************************
* ログアウト処理
*************************************************************************/
int _CENTER02_logout( char *ntm, char *center )
{
int ret;
long tm;
time(&tm);
NtmCenterSetTime( center, NTM_TIME_LOGOUT, tm );
AplRecWrite("%s:Logout", RECKEY);
NTM_wait(1);
NTM_rsPuts( ntm, "OFF\r");
NTM_waitInstr( ntm, 30, "NO CARRIER", NULL );
NTM_offline(ntm, DTR_OFF_TIME);
AplRecWrite("%s:Disconnect", RECKEY);
return (NORMAL);
}
/*************************************************************************
* 受信行のチェック
*************************************************************************/
int _CENTER02_lineCheck( char *ntm, char *buf )
{
return (NORMAL);
}
/*************************************************************************
* フィルタ設定メニュー
*************************************************************************/
int _CENTER02_filterMenu( char *ntm, int x, int y )
{
return NtmUsr_filterMenu( ntm, x, y );
}
/*************************************************************************
* 入力文字列の送信
*************************************************************************/
int _CENTER02_inputCheck( char *ntm, char *s )
{
NTM_rsPuts( ntm, s );
NTM_rsPuts( ntm, "\r" );
return (NORMAL);
}
int CCI_dspCenter02Stt()
{
char *center;
char *name;
long loginTime, logoutTime;
char t1[32], t2[32];
if ( (center = NTM_getCenter(CENTERKEY)) == NULL )
return (ERR);
name = NtmCenterGetName(center);
loginTime = NtmCenterGetTime( center, NTM_TIME_LOGIN );
logoutTime = NtmCenterGetTime( center, NTM_TIME_LOGOUT );
DLG_tmpMsgBox( DLGPOS_CENTER_OF_SCN, DLGPOS_CENTER_OF_SCN,
C_MBLACK, C_DLGBASE, COLMIX(C_INFO,C_GRAY),
" センター名 : %s\n Login time %s \n Last logout time %s ",
name, GetAsciiTime(t1, loginTime), GetAsciiTime(t2,logoutTime) );
return (NORMAL);
}
#undef CENTERKEY
#undef RECKEY